#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define y1 y_alpha_1

using namespace std;

using ll = long long;
using db = double;
using vec = vector<int>;
using pii = pair<int,int>;

int read() {
	int x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-',ch = getchar();
	while(isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48),ch = getchar();
	return f ? -x : x;
}

const int N = 1e5 + 10;
const int inf = 0x3f3f3f3f;

int a[N],n,K,m,b[N],f[N],g[N],s[N],p[N],top;
int ans[N];
bool vis[N];

int findpos(int val,int goal) {
	int pos = lower_bound(b + 1,b + m + 1,val) - b - 1;
	vis[pos] = 1; ans[goal] = b[pos]; return b[pos];
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in; for(int i = 1;i <= n;i++) a[i] = in,s[i] = inf; ++n; a[n] = s[n] = inf; m = in; for(int i = 1;i <= m;i++) b[i] = in; sort(b + 1, b + m + 1);
	for(int i = 1;i <= n;i++) {
		if(~a[i]) {
			int pos = lower_bound(s + 1,s + top + 1,a[i]) - s; s[pos] = a[i]; f[i] = pos; g[pos] = i; p[i] = g[pos - 1]; top = max(top,pos);
		}
		else {
			int pos = top + 1;
			for(int j = m;j >= 1;j--) {
				while(pos > 0 && s[pos - 1] >= b[j]) pos--;
				s[pos] = b[j]; g[pos] = i; top = max(top,pos);
			}
		}
	}
	int cur = f[n],pos = n,val = a[n];
	while(cur > 0) {
		if(~a[pos]) {
			if(a[p[pos]] == -1) val = findpos(val,p[pos]); else val = a[p[pos]];
			pos = p[pos];
		} else {
			bool fl = 0;
			for(int j = pos - 1;j;j--) {
				if(~a[j] && f[j] == cur - 1 && a[j] < val) {
					fl = 1; pos = j; val = a[j]; break;
				}
			}
			if(!fl) {
				for(int j = pos - 1;j;j--) {
					if(!~a[j]) {
						val = findpos(val,j); pos = j; break;
					}
				}
			}
		}
		cur--;
	}
	for(int i = 1,j = 1;i < n;i++)
		if(~a[i]) ans[i] = a[i];
		else {
			if(ans[i]) continue;
			while(vis[j]) j++;
			ans[i] = b[j]; j++;
		}
	for(int i = 1;i < n;i++) printf("%d%c",ans[i]," \n"[i == n - 1]);
	return 0;
}
